#include "bits/stdc++.h"

using namespace std;

int main(){
	int n,a,sum;
	string s;
	stringstream ss;
	
	cin >> n;
	getline(cin,s);
	for(int i = 1;i <= n;i++){
		getline(cin,s);
		
		ss.clear();
		ss.str(s);
		sum = 0;
		while(ss >> a){
			sum +=a;
		}
		cout << sum <<endl;
	}
	
	
	return 0;
}
